<?php
namespace php\geo;

class Position {

    private $longitude;
    private $latitude;

    public function __construct($latitude, $longitude){
        $this->longitude = floatval($longitude);
        $this->latitude = floatval($latitude);
    }

    public function asString() {
        return $this->__toString();
    }
    
    public function __toString() {
        return sprintf("%.6f,%.6f", $this->latitude, $this->longitude);
    }

    public function setLatitude($latitude) {
        $this->latitude = $latitude;
    }

    public function getLatitude() {
        return $this->latitude;
    }

    public function setLongitude($longitude) {
        $this->longitude = $longitude;
    }

    public function getLongitude() {
        return $this->longitude;
    }
}
